package com.itheima.d1_create;

/**
 * method2:实现Runnable接口 Runnable--->Thread
 */
public class demo2 {
    public static void main(String[] args) {
    Runnable t = new MyRunnable();
    Thread thread = new Thread(t);
    thread.start();
    for (int i = 0; i < 5; i++) {
        System.out.println("MainThread execute"+ i);
    }
}
}


class MyRunnable implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println("SubThread execute"+ i);
        }
    }
}